include ../utils/Makefile.incl

SOURCES = $(wildcard *.c)
OBJECTS = $(SOURCES:.c=.o)
ASMS    = $(SOURCES:.c=.s)
DEPENDS = $(SOURCES:.c=.d)

all: $(OBJECTS)

$(OBJECTS): %.o: %.s
	$(AS) $(ASFLAGS) -o $@ $<

$(ASMS): %.s: %.c
	$(XCC) -S $(CFLAGS) $<

$(DEPENDS): %.d: %.c
	$(XCC) -M $(CFLAGS) $< > $@.$$$$; sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; rm -f $@.$$$$

.PHONY: clean

clean:
	rm *.s *.o
